package 作业;
import java.util.ArrayList;
import java.util.Scanner;

public class StudentManage01 {
    Scanner scanner = new Scanner(System.in);
    //规定当前集合 装学生1
    ArrayList<Student> studentList = new ArrayList();

    public static void main(String[] args) {
        StudentManage01 studentManage01 = new StudentManage01();
        studentManage01.init();

    }



    private void init(){
        while (true){
            System.out.println("选择(1、录入;)");
            System.out.println("(0、退出;)");
            int choice = scanner.nextInt();
            if (choice == 1){
                add();
            } else if (choice == 0) {
                printStudent();
                scanner.close();
                break;

            }
        }
    }



    private void printStudent(){

        for (int i = 0; i < studentList.size(); i++) {
            Student student = studentList.get(i);
            // System.out.println(student.getName() + "---" + student.getAge());
        }
    }


    private void add() {
        System.out.println("请输入学生姓名:");
        String name = scanner.next();
        System.out.println("请输入学生的年龄:");
        int age = scanner.nextInt();
        Student student = new Student();
        student.setName(name);
        student.setAge(age);
        studentList.add(student);

    }
}
